﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CanDoo.Data.Entity;
using CanDoo.Oil.Core.Models;

namespace CanDoo.Oil.Core.ModelConfigurations
{
    /// <summary>
    /// 实体类-数据表映射——采购结算单明细
    /// </summary>
    public class BuyStatementDetailConfiguration : EntityConfigurationBase<BuyStatementDetail>
    {
        /// <summary>
        /// 初始化一个<see cref="BuyStatementDetailConfiguration"/>类型的新实例
        /// </summary>
        public BuyStatementDetailConfiguration()
        {
             ToTable("finance_BuyStatementDetail");
             this.Property(p => p.BuyStatementId).HasColumnName("BuyStatementId");
             this.HasRequired(p => p.BuyStatement).WithMany(n=>n.BuyStatementDetails).HasForeignKey(p => p.BuyStatementId).WillCascadeOnDelete(true);

             this.Property(p => p.BuyBillId).HasColumnName("BuyBillId");
             this.HasRequired(p => p.BuyBill).WithMany().HasForeignKey(p => p.BuyBillId).WillCascadeOnDelete(false);

        }
    }
}
